package com.upcode.weighing.vo.sms;

import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author : liqi
 * Date: 2018-05-17
 * Time: 15:46
 */
public class SerialGenerator {

    /**
     * 生成指定位数的验证码
     * @param codeLength
     * @return
     */
    public static String randomNum(int codeLength) {
        StringBuilder randomCode = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < codeLength; ++i) {
            String strRand = String.valueOf(random.nextInt(10));
            randomCode.append(strRand);
        }
        return randomCode.toString();
    }

}
